# coding=utf8
from sqlalchemy import Column, String, SmallInteger, Integer

from database import Base


class AccessToken(Base):
    access_token = Column(String(200))
    expire = Column(Integer)
    grand_ts = Column(Integer)

class WeixinTicket(Base):
    ticket = Column(String(200))
    expire = Column(Integer)
    grand_ts = Column(Integer)


class RegistRequest(Base):
    teamName = Column(String(64))
    leaderMobile = Column(String(11))
    firstMemberMobile = Column(String(11))
    secondMemberMobile = Column(String(11))
    thirdMemberMobile = Column(String(11))
    fourthMemberMobile = Column(String(11))
    payed = Column(SmallInteger)
    src = Column(String(10))

class Team(Base):
    teamName = Column(String(64), unique=True)
    leaderMobile = Column(String(11))
    status = Column(SmallInteger)

class Member(Base):
    teamId = Column(SmallInteger)
    mobile = Column(String(11), unique=True)
    password = Column(String(6))
    realName = Column(String(20))
    idNo = Column(String(18))
    age = Column(SmallInteger)
    address = Column(String(200))
    inited = Column(SmallInteger)
    status = Column(SmallInteger)
    weixinId = Column(String(64))
    
class Manager(Base):
    email = Column(String(100))
    password = Column(String(128))
    valid = Column(SmallInteger)
    
class CheckPoint(Base):
    name = Column(String(100))
    key = Column(String(64))
    point = Column(SmallInteger)

class TeamSignLog(Base):
    team_id = Column(Integer)
    check_point_id = Column(Integer)
    check_count = Column(Integer)
    first_check_ts = Column(Integer)
    last_check_ts = Column(Integer)

class MemberSignLog(Base):
    team_id = Column(Integer)
    member_id = Column(Integer)
    check_point_id = Column(Integer)
    check_ts = Column(Integer)